import { createApp } from 'vue'
import App from './App.vue'
// import Vue from 'vue'
import WaitingTask from './views/desktop/WaitingTask.vue'
import Show from './views/template/Show.vue'
import router from './router'
import store from './store'
import ElementPlus, {ElMessage} from 'element-plus'
import 'element-plus/dist/index.css'
import global from "@/views/global/global";
import axios from "axios";
// import 'element-plus/theme-chalk/dark/css-vars.css'
createApp(App,WaitingTask).use(store).use(router).use(ElementPlus).use(global).mount('#app')
// 全局配置
axios.defaults.baseURL = 'http://localhost:8090'
// 预检跨域时发送请求携带token信息
axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*'
axios.interceptors.request.use(config => {
    let token = global.user.token
    if (token) {
        config.headers.token = token
    }
    return config
})
axios.interceptors.response.use(response => {
    return response
}, error => {
    if (error.response.status === 401) {
        //直接跳转链接
        window.location.href = '/'
    }
})




